package me.lovatcat.springboot.demo.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import me.lovetcat.common.validate.annotation.*;
import me.lovetcat.common.validate.annotation.Mobile;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * @author acat on 2017-01-13 14:22
 */
@ApiModel(value = "用户")
public class UserUpdateVo {

    @ApiModelProperty(value = "用户id", dataType = "int", required = true)
    @NotEmpty(message = "请先选择用户")
    private Integer id;
    @ApiModelProperty(value = "姓名", dataType = "String", required = true)
    @Size(min = 6, max = 20, message = "用户名为6~20个字符")
    private String name;
    @ApiModelProperty(value = "登陆密码", dataType = "String", required = true)
    @Size(min = 6, max = 18, message = "登录密码为6~18个字符")
    private String password;
    @ApiModelProperty(value = "年龄", dataType = "int")
    @Min(value = 0, message = "用户应该大于0岁")
    @Max(value = 150, message = "用户应该小于150岁")
    private Integer age;
    @ApiModelProperty(value = "性别", dataType = "String", allowableValues = "1,2", notes = "1=男，2=女")
    @In(vals = {"1", "2"}, message = "请选择男或女")
    private String sex;
    @ApiModelProperty(value = "手机号码", dataType = "String", required = true)
    @Mobile
    private String mobile;
    @ApiModelProperty(value = "生日", dataType = "Date")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    @Override
    public String toString() {
        return "UserUpdateVo{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                ", mobile='" + mobile + '\'' +
                ", birthday=" + birthday +
                '}';
    }
}
